//
//  RequestApi+Login.swift
//  接口请求- 登录
//
//  Created by 千策万划-mini on 2025/4/29.
//

import Foundation

class LoginRequestApi: RequestApi {
    
    // MARK: - 获取登录/注册短信验证码
    class func getLoginCode(
        phone: String,
        success: @escaping RequestSuccess, failure: @escaping RequestFailure
    ) {
        var parameters: [String: Any]? {
            return [
                "waked": phone,
                "bade":  GlobalMethod.getConfusion()
            ]
        }
        post(path: ApiConfig.getLoginCode, parameters: parameters, success: success, failure: failure)
    }
    
    // MARK: - 验证码登陆/注册
    class func login(
        phone: String,
        code: String,
        success: @escaping RequestSuccess, failure: @escaping RequestFailure
    ) {
        var parameters: [String: Any]? {
            return [
                "cap":  phone,
                "slow": code,
                "huh":  GlobalMethod.getConfusion()
            ]
        }
        post(path: ApiConfig.login, parameters: parameters, success: success, failure: failure)
    }
    
    // MARK: - 退出登录
    class func logout(
        success: @escaping RequestSuccess, failure: @escaping RequestFailure
    ) {
        var parameters: [String: Any]? {
            return [
                "nuisance": GlobalMethod.getConfusion(),
                "chewing":  GlobalMethod.getConfusion()
            ]
        }
        get(path: ApiConfig.logout, parameters: parameters, success: success, failure: failure)
    }
    
    // MARK: - 注销账号
    class func cancelAccount(
        success: @escaping RequestSuccess, failure: @escaping RequestFailure
    ) {
        var parameters: [String: Any]? {
            return [
                "grunted":  GlobalMethod.getConfusion()
            ]
        }
        get(path: ApiConfig.cancelAccount, parameters: parameters, success: success, failure: failure)
    }
}
